package com.soft.servlet;

import com.soft.service.Domain;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author kongz
 * @version 1.0 2021/6/7 16:16
 * @description 购物车信息删除
 */
@WebServlet(name = "GouWuCheDeleteServlet", urlPatterns = "/GouWuCheDelete")
public class GouWuCheDeleteServlet extends HttpServlet {

    private Domain domain;

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        domain = new Domain();

        int trolleyInfoId = Integer.parseInt(req.getParameter("trolleyInfoId"));
        if (domain.deleteTrolleyInfo(trolleyInfoId))
            req.getSession().setAttribute("flag", 40);
        else
            req.getSession().setAttribute("flag", 41);
        req.getRequestDispatcher("/GouWuCheList").forward(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }
}
